package com.mlf.abstractFactory.spring.product;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AbstractFactoryConfig {

    @Bean
    @ConditionalOnProperty(name = "product.type", havingValue = "A")
    public ProductFactory productAFactory() {
        return new ProductAFactory();
    }

    @Bean
    @ConditionalOnProperty(name = "product.type", havingValue = "B")
    public ProductFactory productBFactory() {
        return new ProductBFactory();
    }
}
